if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_ISO_InsertGiaoAnLyThuyet]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[sp_ISO_InsertGiaoAnLyThuyet]
GO
CREATE PROCEDURE sp_ISO_InsertGiaoAnLyThuyet
	@ID	int output,
	@MA_KHGD int,
	@So_giao_an int,
	@Ngay_thuc_hien datetime,
	@Muc_tieu nvarchar(2000),
	@Do_dung_PT_DH nvarchar(2000),
	@On_dinh_LH nvarchar(2000),
	@Thoi_gian_on_dinh int,
	@Thoi_gian_TH_BH int,
	@Dan_nhap nvarchar(2000),
	@HD_dan_nhap_GV nvarchar(2000),
	@HD_dan_nhap_HS nvarchar(2000),
	@Thoi_gian_dan_nhap int,
	@Noi_dung_bai_giang nvarchar(4000),
	@HD_giang_bai_moi_GV nvarchar(2000),
	@HD_giang_bai_moi_HS nvarchar(2000),
	@Thoi_gian_bai_giang int,
	@Cung_co_kien_thuc nvarchar(2000),
	@HD_cung_co_GV nvarchar(2000),
	@HD_cung_co_HS nvarchar(2000),
	@Thoi_gian_cung_co int, 
	@Huong_dan_tu_hoc nvarchar(40),
	@HD_HDTH_GV nvarchar(2000),
	@HD_HDTH_HS nvarchar(2000),
	@Thoi_gian_HDTH int,
	@Tai_lieu_tham_khao nvarchar(40),
	@Ngay_tao datetime,
	@Ten_Chuong nvarchar(2000),
	@Ma_Giao_Vien int
AS
BEGIN
	INSERT INTO GIAOAN(
		MA_KHGD,
		So_giao_an,
		Ngay_thuc_hien,
		Muc_tieu,
		Do_dung_PT_DH,
		On_dinh_LH,
		Thoi_gian_on_dinh,
		Thoi_gian_TH_BH,
		Dan_nhap,
		HD_dan_nhap_GV,
		HD_dan_nhap_HS,
		Thoi_gian_dan_nhap,
		Noi_dung_bai_giang,
		HD_giang_bai_moi_GV,
		HD_giang_bai_moi_HS,
		Thoi_gian_bai_giang,
		Cung_co_kien_thuc,
		HD_cung_co_GV,
		HD_cung_co_HS,
		Thoi_gian_cung_co,
		Huong_dan_tu_hoc,
		HD_HDTH_GV,
		HD_HDTH_HS,
		Thoi_gian_HDTH,
		Tai_lieu_tham_khao,
		Ngay_tao,
		Tinh_trang,
		Ten_Chuong,
		Ma_Giao_Vien
	)
	VALUES 
	(
		@MA_KHGD,
		@So_giao_an,
		@Ngay_thuc_hien,
		@Muc_tieu,
		@Do_dung_PT_DH,
		@On_dinh_LH,
		@Thoi_gian_on_dinh,
		@Thoi_gian_TH_BH,
		@Dan_nhap,
		@HD_dan_nhap_GV,
		@HD_dan_nhap_HS,
		@Thoi_gian_dan_nhap,
		@Noi_dung_bai_giang,
		@HD_giang_bai_moi_GV,
		@HD_giang_bai_moi_HS,
		@Thoi_gian_bai_giang,
		@Cung_co_kien_thuc,
		@HD_cung_co_GV,
		@HD_cung_co_HS,
		@Thoi_gian_cung_co,
		@Huong_dan_tu_hoc,
		@HD_HDTH_GV,
		@HD_HDTH_HS,
		@Thoi_gian_HDTH,
		@Tai_lieu_tham_khao,
		@Ngay_tao,
		0,
		@Ten_Chuong,
		@Ma_Giao_Vien
	)

	SELECT @ID=MAX(ID) FROM GIAOAN 
END
